Hello,
At least since DOORS 9.3, it is possible to purge a deleted object and its hierrarchy (Edit -> Object -> Purge...)
Is there a DXL function doing exactly the same?
Thanks in advance.
Best regards, MattMar MattMar - Tue Mar 22 09:52:37 EDT 2016 |
Re: HardDelete a deleted object with hierarchy You might want to look in help file at: hardDelete (object)Declaration void hardDelete(Object o) void delete(Object o) Operation
Removes object o; the object cannot be recovered with
The form |
Re: HardDelete a deleted object with hierarchy Hello,
Thank you for your answer but hardDelete() does not work on deleted object and does not work on object with descendant whereas the function in the menu works in these cases.
The only solution I have is to implement my own function to hardDelete object with the hierrarchy.
Best regards, MattMar |
Re: HardDelete a deleted object with hierarchy MattMar - Tue Mar 22 12:06:20 EDT 2016 Hello,
Thank you for your answer but hardDelete() does not work on deleted object and does not work on object with descendant whereas the function in the menu works in these cases.
The only solution I have is to implement my own function to hardDelete object with the hierrarchy.
Best regards, MattMar |
Re: HardDelete a deleted object with hierarchy Some earlier discussions on the same issue, with code examples
and
|
Re: HardDelete a deleted object with hierarchy Hello,
Thanks to all for your replies.
What I need to do is to purge (not softDelete) all objects deleted 6 months ago or earlier which has been baselined since it has been deleted.
Whenever I get deleted object with hierarchy it is quite a mess as there many cases to manage (deleted objects with children and descendants, DOORS tables...).
The only solution I found is the following:
/*
* This function tries to hardDelete object o
* If it succeeds it returns true
*
*/
bool myHardDelete(Object o) {
bool bRes = false
string sMsg
noError()
hardDelete(o)
sMsg = lastError()
if (null sMsg || sMsg == "") {
bRes = true
flushDeletions()
}
return bRes
}
/*
* This function retrieves all descendant of the object to purge
* If it succeeds it returns true
*
*/
bool myPurgeObject(Object o) {
bool bRes = false
bool bFound = false
// List of descendants to be deleted
Skip skpList = create
int nbObjects = 0
Module m = module(o)
current = m
filtering off
sorting(false)
Object oTgt
// hardDelete only works on undeleted objects. Undeleting object undelete descendants
if (isDeleted(o)) undelete(o)
// Retrieve all descendants of the object
for oTgt in entire(m) do {
if (!matches("^" number(o) "\\.", number(oTgt))) {
// No more descendants
if (bFound) break
// We have reached the parent object
if (oTgt == o) bFound = true
continue
}
// oTgt is a descendant of o and must be deleted
put(skpList, nbObjects++, oTgt)
}
print "\n"
nbPrev = nbObjects
int iKey
// While we have desendants we try to delete them
while (nbObjects > 0) {
for oTgt in skpList do {
iKey = (int key skpList)
if (myHardDelete(oTgt)) {
nbObjects--
delete(skpList, iKey)
}
}
// If number of descendants remains twice stop trying to purge descendants
if (nbPrev == nbObjects) break
nbPrev = nbObjects
}
delete(skpList)
// Purge object o
if (myHardDelete(o)) {
// if all descendants have been deleted return true
if (nbObjects == 0) bRes = true
} else {
// If purge fails softDelete object
softDelete(o)
}
return bRes
}
|